package com.example.mybatisee.dao;

import com.example.mybatisee.model.ArticleInfo;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;

import java.util.List;

import static org.junit.jupiter.api.Assertions.*;

@SpringBootTest
class ArticleInfoMapperTest {

    @Resource
    private ArticleInfoMapper articleInfoMapper;

    @Test
    void getAll() {
        List<ArticleInfo> list = articleInfoMapper.getAll();
        list.forEach(System.out::println);
    }

    @Test
    void addArticle() {
        ArticleInfo articleInfo = new ArticleInfo();
        articleInfo.setTitle("该第二篇了");
        articleInfo.setContent("还是文章插入操作");
        articleInfo.setUid(1);
        int result = articleInfoMapper.addArticle(articleInfo);
        System.out.println(result);
    }

    @Test
    void selArticle() {
        ArticleInfo articleInfo = articleInfoMapper.selArticle(0,"又是第一篇");
        System.out.println(articleInfo);
    }
}